// Package controllers
package controllers

import (
	"fmt"
	"net/http"
	"strings"
)

func SayHello(w http.ResponseWriter, r *http.Request) {
	r.ParseForm() //解析参数，默认不会解析

	fmt.Println(r.Form) //这些信息是输出到服务器端的打印信息
	fmt.Println("path", r.URL.Path)
	fmt.Println("scheme", r.URL.Scheme)
	fmt.Println(r.Form["url_long"])

	for k, v := range r.Form {
		fmt.Println("key:", k)
		fmt.Println("val:", strings.Join(v, ""))
	}

	fmt.Fprintf(w, "Hello World!") //这个写入到w的是输出到客户端的
}
